package afk.biglog;

import java.util.*;

public class BlockFilter
{
	private final List<String> blackList = new ArrayList<String>();
	private final List<String> whiteList = new ArrayList<String>();

	public List<String> getBlackList()
	{
		return blackList;
	}

	public List<String> getWhiteList()
	{
		return whiteList;
	}

	public boolean allow(final String line)
	{
		if (isAllowAll())
			return true;
		for (final String disAllow : blackList)
			if (line.matches(disAllow))
				return false;
		for (final String allow : whiteList)
			if (line.contains(allow))
				return true;
		return false;
	}

	private boolean isAllowAll()
	{
		return (blackList.size() == 0) && (whiteList.size() == 0);
	}
}
